#pragma noce

#include<string>
using namespace std;


enum  CommonError
{
    OK=0,
    SOCKET_ERROR, // socket创建失败
    BIND_ERROR,    // bind失败
    SENDTO_ERROR,   
    RECVFROM_ERROR
};

CommonError common_error=CommonError::OK;


string ErrortoString(CommonError e)
{
    string s;
    switch (e)
    {
    case CommonError::SOCKET_ERROR:
        s = "deadly: socket_error";
        break;
    case CommonError::BIND_ERROR:
        s = "deadly: bind_error";
        break;
    case CommonError::SENDTO_ERROR:
        s = "error: sendto_error";
        break;
    case CommonError::RECVFROM_ERROR:
        s = "error: recvfrom_error";
        break;
    default:
        s = "deadly unknown error"; // 未知错误
        break;
    }
    return s;
}